import { SYMBOLS } from '../../../types/interfaces'

export function styles(className: string): string {
  return `
    /* 主容器 */
    .${className} {
      border-radius: 8px;
      padding: 0;
    }
    
    .style-preview {
      border: 1px solid #e1e4e8;
      border-radius: 6px;
      background: #f6f8fa;
      margin-top: 15px;
      overflow: hidden;
    }
    
    .preview-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 12px;
      border-radius: 8px 8px 0 0;
      background: #606266;
      color: white;
      font-size: 13px;
      
      .header-actions {
        display: flex;
        gap: 8px;
      }
      
      .copy-btn, .clear-all, .sync-btn {
        background: #0366d6;
        color: white;
        border: none;
        border-radius: 3px;
        padding: 3px 8px;
        cursor: pointer;
        user-select: none !important;
        transition: background 0.2s;
        
        &:hover {
          background: #0356b6;
        }
      }
      
      .clear-all {
        background: #d73a49;
        
        &:hover {
          background: #c13232;
        }
      }
      
      .sync-btn {
        background: #28a745;
        
        &:hover {
          background: #22863a;
        }
        
        &::after {
          content: "${SYMBOLS.ARROWS.CIRCLE}";
          margin-left: 5px;
          font-size: 0.9em;
        }
      }
    }
    
    .preview-content {
      padding: 12px;
      overflow-x: auto;
      
      .line {
        display: flex;
        padding: 5px;
        font-size: 14px;
      }
      
      /* 行号生成 */
      .line:before {
        counter-increment: line-number;
        content: counter(line-number);
        display: inline-block;
        width: 40px;
        padding-right: 10px;
        color: #6a737d;
        text-align: right;
        font-style: normal;
        user-select: none !important;
      }
      
      /* 内容区域 */
      pre {
        all: initial;
        margin: 0;
        font-size: 13px;
        line-height: 1.5;
        color: #333;
        counter-reset: line-number;
        
        .line {
          display: flex;
          align-items: stretch;
          position: relative;
          font-size: 13px;
          min-height: 22px; /* 固定最小高度 */
          padding: 0;
          margin: 0;
          /* 内容区域 */
          .content {
            flex: 1;
            white-space: pre-wrap;
            padding-left: 12px;
            color: #1d7e27;
            border-left: 1px solid #909399; /* 仅左边框 */
            position: relative; /* 确保内容在上层 */
          }
          
          /* 删除按钮 */
          .delete-btn {
            position: absolute;
            left: 5px;
            color: #d73a49;
            cursor: pointer;
            font-weight: bold;
            opacity: 0.5;
            transition: opacity 0.2s;
            user-select: none !important; /* 关键修改：禁止选中删除图标 */
            -webkit-user-select: none !important; /* Safari兼容 */
            -moz-user-select: none !important; /* Firefox兼容 */
            -ms-user-select: none !important; /* IE兼容 */
            &:hover {
              opacity: 1;
            }
          }
        }
        
        /* 选择器注释 */
        .line.comment {
          .content {
            color: #d90165 !important;
            font-style: italic;
          }
        }
        
        /* 新增样式高亮 */
        .line.highlight {
          .content {
            &::before {
              content: '';
              position: absolute;
              left: 5px;
              top: 0;
              bottom: 0;
              right: 0;
              background-color: rgba(255, 229, 100, 0.3);
              mix-blend-mode: multiply; /* 避免颜色叠加导致字体变暗 */
              pointer-events: none; /* 防止遮挡交互 */
            }
          }
        }
      }
    }
  `
}
